#include <stdio.h>
int main()
{int n;
int i;
char c;
int v,p,l,m;
 int b;
scanf("%d",&n);
for(i=1;i<=n;i++)
   {

    scanf("%c",&c);
    int b=c;
    if(65<=b&&b<=90||b>=97&&b<=122)
        v++;
   else if (b==32||b==13)
        p++;
    else  if (b<=57&&b>=48)
        l++;
        else
            m++;
        }printf("%d %d %d %d",v,p,l,m);
return 0;}
